<?php

include('../confdb.php');

$con = mysqli_connect($db_host, $db_user, $db_pass, $db_name);
$idvistuplenie = $_POST['idvistuplenie'] ?? '';
    
    $sql = "SELECT idvistuplenie FROM vistuplenie where vistuplenie_zaversheno=1 ORDER BY idvistuplenie DESC LIMIT 1";
    $result = mysqli_query($con, $sql);
    $idsav = mysqli_fetch_assoc($result)['idvistuplenie'];
    $otvet['success'] = $idsav;
    if($idvistuplenie == $idsav) {
        $otvet['success'] = 1;
    } else {
        $otvet['success'] = 0;
    }
    

echo json_encode($otvet);
 

?>

